{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\k1801607\Dropbox\Trump2_accepted\paper.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res} 4 Jul 2019, 18:13:59
{txt}
{com}. 
. *REPLICATION MATERIAL FOR THE PAPER
. 
. clear all
{res}{txt}
{com}. use data.dta
{txt}
{com}. 
. set more off
{txt}
{com}. 
. *You need these two packages to run the code
. 
. *ssc install ebalance
. *ssc install coefplot
. 
. *******************************************************************************************
. *******                                     TABLE 1
. *******************************************************************************************
. 
. 
. quietly: logit  race  trump  [pweight=dweight] if election2016==1 & interval==1, cluster(country)
{txt}
{com}. quietly: margins, dydx(*) post
{txt}
{com}. est store a1
{txt}
{com}. quietly:logit  race  trump i.country [pweight=dweight] if election2016==1 & interval==1, cluster(country)
{txt}
{com}. quietly: margins, dydx(*) post
{txt}
{com}. est store a2
{txt}
{com}. quietly:logit  race  trump age squaredage female domicil child minority i.country [pweight=dweight] if election2016==1 & interval==1, cluster(country) 
{txt}
{com}. quietly: margins, dydx(*) post
{txt}
{com}. est store a3
{txt}
{com}. quietly:logit  race  trump age squaredage female domicil child minority edu hincfel uemp3m i.country [pweight=dweight] if election2016==1 & interval==1, cluster(country)
{txt}
{com}. quietly: margins, dydx(*) post
{txt}
{com}. est store a4
{txt}
{com}. quietly:logit  race  trump age squaredage female domicil child minority edu hincfel uemp3m voting i.country [pweight=dweight] if election2016==1 & interval==1 , cluster(country) 
{txt}
{com}. quietly: margins, dydx(*) post
{txt}
{com}. est store a5
{txt}
{com}. quietly:  ebalance  trump  age  female domicil  child minority edu hincfel uemp3m voting country if election2016==1 & interval==1 , tar(3)
{txt}
{com}. quietly: logit  race  trump age squaredage female domicil child minority edu hincfel  uemp3m voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)              
{txt}
{com}. quietly: margins, dydx(*) post
{txt}
{com}. est store a6
{txt}
{com}. 
. *here is table 1, printed
. 
. esttab a1 a2 a3 a4 a5 a6, keep(trump) se obslast collabels(, none)  star(* 0.10 ** 0.05 *** 0.01)  wrap    nonumbers cells(b(star fmt(3)) se(fmt(3) par)) compress  
{res}
{txt}{hline 88}
{txt}                                                                                        
{txt}{hline 88}
{txt}trump     {res}     0.031***     0.017*       0.020**      0.021**      0.022***     0.023***{txt}
          {res}   (0.011)      (0.009)      (0.008)      (0.008)      (0.008)      (0.008)   {txt}
{txt}{hline 88}
{txt}N         {res}      7904         7904         7855         7753         7717         7717   {txt}
{txt}{hline 88}

{com}. 
. 
.  
. *******************************************************************************************
.  ****                                           FIGURE 1 
. *******************************************************************************************
.  
.  *The graphs in the paper are just aesthetically different (we exported coefficients in excel, believing they will look better)
.  
. **********************************************
.  *** 1.A: Trump Vs Previous elections***
. **********************************************
. 
.  
. *BUSH 2004
. 
. quietly: ebalance  trump age  female domicil child minority edu hincfel uemp3m voting country if election2004==1, tar(3)
{txt}
{com}. quietly:  logit  race  trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2004==1, cluster(country)              
{txt}
{com}. quietly: margins, dydx(*) post //this is the first coefficient plotted in figure 1.a, referred to as "Bush 2004"
{txt}
{com}. est store a1
{txt}
{com}. 
. *OBAMA 2008
. 
. quietly: ebalance  trump age  female domicil child minority edu hincfel uemp3m voting country if election2008==1, tar(3)
{txt}
{com}. quietly: logit  race  trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2008==1, cluster(country)              
{txt}
{com}. quietly: margins, dydx(*) post //this is the second coefficient plotted in figure 1.a, referred to as "Obama 2008"
{txt}
{com}. est store a2
{txt}
{com}. 
. *OBAMA 2012
. 
. quietly:  ebalance  trump age  female domicil child minority edu hincfel uemp3m voting country if election2012==1, tar(3)
{txt}
{com}. quietly:  logit  race  trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2012==1, cluster(country)              
{txt}
{com}. quietly: margins, dydx(*) post //this is the third coefficient plotted in figure 1.a, referred to as "Obama 2012"
{txt}
{com}. est store a3
{txt}
{com}.  
. *TRUMP 2016
. 
. quietly:  ebalance  trump  age  female domicil  child minority edu hincfel uemp3m voting country if election2016==1 & interval==1 , tar(3)
{txt}
{com}. quietly: logit  race  trump age squaredage female domicil child minority edu hincfel  uemp3m voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)              
{txt}
{com}. quietly: margins, dydx(*) post //this is the last coefficient plotted in figure 1.a, referred to as "Trump 2016"
{txt}
{com}. est store a4
{txt}
{com}.  
. coefplot (a1, label(Bush 2004) pstyle(p1))  (a2, label(Obama 2008) pstyle(p2)) (a3, label(Obama 2012) pstyle(p3))  (a4, label(Trump 2016) pstyle(p4)) , keep(trump)  xlabel("")   vertical drop(_cons) yline(0)
{res}{txt}
{com}. 
. **********************************************
.  *** 1.B: Racist Vs Immigration attitudes***
. **********************************************
. 
. 
. quietly: ebalance  trump age  female domicil child minority edu hincfel  uemp3m voting country if election2016==1 & interval==1, tar(3)
{txt}
{com}. 
. *****OPPOSE POOR MIGRANTS
. quietly: ologit  imstrict trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
{txt}
{com}. est store a1 // coefficient for " Oppose poor Migrants"
{txt}
{com}. 
. *****OPPOSE REFUGEES
. quietly: ologit  refustrict trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
{txt}
{com}. est store a2 // coefficient for " Oppose Refugees"
{txt}
{com}. 
.  *****ECONOMIC CONCERNS FOR IMMIGRATION
. quietly: ologit  imeco trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)     
{txt}
{com}. est store a3 // coefficient for " Immigration harms Economy"
{txt}
{com}. 
. *****CULTURAL CONCERNS FOR IMMIGRATION
. quietly: ologit  imueclt trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
{txt}
{com}. est store a4 // coefficient for " Immigration harms Culture"    
{txt}
{com}.  
. coefplot (a1, label(Oppose poor migrant) pstyle(p1))  (a2, label(Oppose refugees) pstyle(p2)) (a3, label(Economy) pstyle(p3))  (a4, label(Culture) pstyle(p4)) , keep(trump)  xlabel("")  vertical drop(_cons) yline(0)
{res}{txt}
{com}. 
. **********************************************
.  *** 1.C: Electoral Vs Campaign effect***
. **********************************************
. 
. 
. *****FAKE1: 7 days before  
. quietly: ebalance  trumpbefore1 age  female domicil child minority edu hincfel    uemp3m voting country if interval1==1, tar(3)
{txt}
{com}. quietly: logit  race  trumpbefore1 age squaredage female domicil child minority edu hincfel   uemp3m  voting i.country [pweight=dweight* _webal] if interval1==1, cluster(country)              
{txt}
{com}. quietly: margins, dydx( *) post  //This is the first coefficient plotted
{txt}
{com}. est store a1
{txt}
{com}.  
. *****FAKE1: 15 days before  
. quietly: ebalance  trumpbefore2 age  female domicil child minority edu hincfel   uemp3m voting country  if interval2==1 & country!=4, tar(3)
{txt}
{com}. quietly: logit  race  trumpbefore2 age squaredage female domicil child minority edu hincfel   uemp3m  voting i.country [pweight=dweight* _webal]  if interval2==1 & country!=4, cluster(country)              
{txt}
{com}. quietly: margins, dydx( *)  post //This is the second coefficient plotted
{txt}
{com}. est store a2
{txt}
{com}.  
. *****FAKE1: 3 weeks before  
. quietly: ebalance  trumpbefore3 age  female domicil child minority edu hincfel  uemp3m voting country  if interval3==1 & country!=4, tar(3)
{txt}
{com}. quietly: logit  race  trumpbefore3 age squaredage female domicil child minority edu hincfel   uemp3m  voting i.country [pweight=dweight* _webal]  if interval3==1 & country!=4, cluster(country)              
{txt}
{com}. quietly: margins, dydx( *) post  //This is the third coefficient plotted
{txt}
{com}. est store a3
{txt}
{com}.  
. *****FAKE1: one month before  
. quietly: ebalance  trumpbefore4 age  female domicil child minority edu hincfel  uemp3m voting country  if interval4==1 & country!=4, tar(3)
{txt}
{com}. quietly: logit  race  trumpbefore4 age squaredage female domicil child minority edu hincfel   uemp3m  voting i.country [pweight=dweight* _webal]  if interval4==1 & country!=4, cluster(country)              
{txt}
{com}. quietly: margins, dydx( *) post  //This is the third coefficient plotted
{txt}
{com}. est store a4
{txt}
{com}. 
. coefplot (a1, label(one week) pstyle(p1))  (a2, label(15 days) pstyle(p2)) (a3, label(three weeks) pstyle(p3))  (a4, label(one month) pstyle(p4)) , keep(trumpbefore1 trumpbefore2 trumpbefore3 trumpbefore4)   xlabel("")  vertical drop(_cons) yline(0)
{res}{txt}
{com}. 
.  
. **********************************************
.  *** 1.D: Electoral Vs Bandwagon effect***
. **********************************************
.    
. 
. quietly: ebalance  trump age  female domicil child minority edu hincfel  uemp3m voting country if election2016==1 & interval==1, tar(3)
{txt}
{com}. 
.  *****LEFT-RIGHT SCALE 
. quietly: ologit  lrscale trump age squaredage female domicil child minority edu hincfel  uemp3m voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
{txt}
{com}. est store a1  //This is the first coefficient plotted
{txt}
{com}. 
. *****POPULIST PARTY
. quietly: ologit  populist trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
{txt}
{com}. est store a2 //This is the second coefficient plotted 
{txt}
{com}. 
. *****OPPOSE REDISTRIBUTION
. quietly: ologit  redistribution trump age squaredage female domicil child minority edu hincfel  uemp3m voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
{txt}
{com}. est store a3  //This is the third coefficient plotted
{txt}
{com}. 
. *****OPPOSE GAY RIGHTS
. quietly: ologit  homosexright trump age squaredage female domicil child minority edu hincfel uemp3m  voting i.country [pweight= _webal*dweight] if election2016==1 & interval==1, cluster(country)      
{txt}
{com}. est store a4  //This is the last coefficient plotted
{txt}
{com}. 
. coefplot (a1, label(left-right) pstyle(p1))  (a2, label(populist) pstyle(p2)) (a3, label(redistribution) pstyle(p3))  (a4, label(homosexual right) pstyle(p4)) , keep(trump)  xlabel("")  vertical drop(_cons) yline(0)
{res}{txt}
{com}. 
.    
. ********************************************************************************************************************************************************************************************************************************************************************
. 
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\k1801607\Dropbox\Trump2_accepted\paper.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res} 4 Jul 2019, 18:18:02
{txt}{.-}
{smcl}
{txt}{sf}{ul off}